import java.util.Date;

import service.Reservation
import service.Room

class BootStrap {

    def init = { servletContext ->
		if(!Room.count()) {
			new Room(name:'B07',building:'1TP1',capacity:'30').save(FailOnError:true)
			new Room(name:'B08',building:'1TP1',capacity:'20').save(FailOnError:true)
			new Room(name:'B09',building:'1TP1',capacity:'23').save(FailOnError:true)
			new Room(name:'B10',building:'1TP1',capacity:'15').save(FailOnError:true)
		}
		if(!Reservation.count()) {
			new Reservation(name:"IAWS", dateBegSession: new Date(112, 4, 2, 8, 0), dateEndSession: new Date(112, 4, 2, 10, 0), room: Room.findByName('B07')).save(FailOnError:true)
		}
		
    }
    def destroy = {
    }
}
